/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package calculation;

import java.io.Serializable;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author jzajaczek
 */
@ManagedBean(name="ring_area")
@SessionScoped
public class RingAreaBean extends AreaBean implements Serializable {
    @ManagedProperty(value="100.0")
    private double id;
  
    @ManagedProperty(value="140.0")
    private double od;
    private double area;
  
    ToolUnitBean tu = new ToolUnitBean();

    public String check() {
        if (this.id >= this.od) {
            return "failure";
        } else {
            return "success";
        }
    }

    /**
     * @return the id
     */
    public double getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(double id) {
        this.id = id;
    }

    /**
     * @return the od
     */
    public double getOd() {
        return od;
    }

    /**
     * @param od the od to set
     */
    public void setOd(double od) {
        this.od = od;
    }

    /**
     * @return the area
     */
    @Override
    public double getArea() {
        return tu.round(0.25 * Math.PI * (this.od * this.od - this.id * this.id), 2);
    }

    /**
     * @param area the area to set
     */
    @Override
    public void setArea(double area) {
        this.area = area;
    }
}